
<div class="container_12 primary_content_wrap clearfix">
    <div class="clearfix">
        <div class="home-page-content">
            <div class="grid_12">
                <div class="widget-main" id="my_poststypewidget-4"><div class="giohang"><h3>Sản phẩm mới</h3></div>
                    <ul class="post_list recent_products">
                        <?php
                        include 'mySQLConnect.php';
                        $sql3 = "SELECT * FROM  product ORDER BY date DESC LIMIT 0,8";

                        $result3 = mysql_query($sql3);
                        $count = 0;
                        while ($row3 = mysql_fetch_array($result3)) {
                            $count++;
                            $image_url = $row3['image_url'];

                            if (strpos($image_url, '../') !== false) {
                                $image_url = substr($image_url, 3);
                            }

                            $price = ($row3['price']);
                            $temp = "";
                            $price = strrev($price);
                            while (strlen($price) >= 4) {
                                $temp = $temp . substr($price, 0, 3) . '.';
                                $price = substr($price, 3);
                            }

                            if (strlen($price) == 0) {
                                $price = strrev($temp);
                            } else {
                                $price = strrev($price) . strrev($temp);
                            }
                            ?>
                            <li class="cat_post_item-1 clearfix">
                                <figure class="featured-thumbnail">
                                    <a href="detailProduct.php?id=<?php echo $row3['id'] ?>">
                                        <img alt="Flower Shop" title="<?php echo $row3['short_desc'] ?>"
                                             src="<?php echo $image_url; ?>">
                                    </a>
                                </figure>
                                <div class="extra-wrap">
                                    <table>
                                        <tr>
                                            <td>SP:</td>
                                            <td><h5><span
                                                        class="price"><?php echo urldecode($row3['name']) ?></span></a>
                                                </h5>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Giá:</td>
                                            <td><h5><span class="price"><?php echo $price ?> VND</span></h5></td>
                                        </tr>

                                    </table>
                                    <div class="shop-options">
                                        <a href="detailProduct.php?id=<?php echo $row3['id'] ?>"><img
                                                src="images/chitiet.png"></a>
                                    </div>
                                </div>
                            </li>
                        <?php
                        }

                        if ($count == 0) {
                            echo 'sản phẩm đang được cập nhật';
                        }

                        include 'mySQLClose.php';
                        ?>
                    </ul>
                </div>
            </div>
            <div class="clear"></div>
        </div>

        <div class="top-content">
            <div class="grid_12">
                <div class="giohang"> <h3>Tin tức mới</h3></div>
                <?php
                include 'mySQLConnect.php';
                $sql3 = "SELECT * FROM  news ORDER BY date DESC LIMIT 0,2";

                $result3 = mysql_query($sql3);
                while ($row3 = mysql_fetch_array($result3)) {
                    ?>
                    <div>
                        <h4><a href="detailNews.php?id=<?php echo $row3['id'] ?>"><?php echo  urldecode($row3['name'])?></a></h4>

                        <p><?php echo urldecode($row3['short_desc'])?>
                            <a href="detailNews.php?id=<?php echo $row3['id'] ?>" style="font-style: italic">xem thêm</a>
                        </p>
                    </div>
                <?php
                }
                ?>
            </div>
            <div class="clear"></div>
        </div>
    </div>
</div>
